-
Notifications
You must be signed in to change notification settings - Fork 418
Fix duplicate HTLC fail-back on stale force-close #4010
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
👋 I see @tnull was un-assigned. |
This PR is still work in progress. Need some help with the test, I'm able to simulate the scenario described in the issue but the change introduced is triggered when the node restarts and I'm not sure how to simulate that (did a network disconnection and reconnection, but that doesn't seem to do the job). |
🔔 1st Reminder Hey @tnull! This PR has been waiting for your review. |
lightning/src/ln/channelmanager.rs
Outdated
} | ||
} | ||
if !found_htlc { | ||
// Collecting all outbound HTLC sources into a HashSet allows for efficient, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the ChannelMonitor
is the source of the issue here - the issue was about HTLCs being failed back from the on-chain logic in ChannelMonitor
(which is responsible for HTLCs once we close a channel) so it should be fixed, not worked around here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thank you for pointing that out.
🔔 2nd Reminder Hey @tnull! This PR has been waiting for your review. |
40366b8
to
efbbe8b
Compare
efbbe8b
to
146daef
Compare
This PR addresses the duplicate HTLC fail-back on stale force-close that fail-back one of them and waits till timeout to fail-back everything. This change adds proper tracking of HTLCs by payment hash to ensure all identical HTLCs are failed back immediately when detected, rather than waiting for timeout.
Also introduces a functional test that demonstrates the scenario by creating two identical HTLCs, performing a stale force-close, and verifying both HTLCs are failed back correctly.
Fixes #3570